home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / os2 / os2nt.zip / OS2NT.TXT < prev    next >
Text File  |  1993-07-18  |  13KB  |  348 lines

  1. Introduction
  2. ============
  3.  
  4. There are several notes discussing coexistence of DOS, NT and OS/2 on
  5. one system.  I did it on a system with two SCSI disk drives.
  6.  
  7. There must be many ways to accomplish this, but there are some that I
  8. tried which can lead to disastrous results.  This happened apparently
  9. because MSDOS 6.0 and OS/2 appear to treat partitioning on a second
  10. physical hard disk differently vis-a-vis logical DRIVE designations.
  11. I'll describe this situation.
  12.  
  13. Some claim that a successful installation can be made in which the OS/2
  14. boot manager can select DOS or OS/2.  If you then select DOS, then the
  15. NT boot manager will allow you to select NT or DOS.  I tried to follow
  16. this scenario, but there appears to be a bug in the OS/2 Boot Manager
  17. that prevents NT from starting.  The bug may only be if NT is installed
  18. on a separate NTFS partition.  I've isolated this problem and propose a
  19. work-around.
  20.  
  21. The work-around involves a C program that can save and restore partion
  22. records.  There are 4 partion records stored in the master boot record
  23. on each physical disk.  This 512 byte sector can be saved, modified and
  24. restored by a simple program.  Even if the NT installation puts zeros in
  25. the OS/2 Boot Manager partition record (it did), it can be restored.
  26. Even if the the OS/2 Boot Manager modifies a byte in the NT partion
  27. record (it does), it can be restored.  The technique is sketched at the
  28. end of this note.
  29.  
  30. The usual recommendation is to install NT then OS/2.  I reversed that
  31. order, and discovered that NT deleted the OS/2 Boot Manager partition
  32. data in the master boot record.  I restored it with the partition record
  33. program.
  34.  
  35. In all cases OS/2 is version 2.1 on CD-ROM and NT is the March Beta.
  36.  
  37. Machine Base
  38. ============
  39.  
  40. My machine is a 486/33 with May '91 AMI Bios, 16M RAM and a 632M primary
  41. and a 495M second SCSI disk.
  42.  
  43. The first 2 partitions of the first disk are Primary Dos and Extended
  44. DOS respectively.
  45.  
  46. The 3rd partition is "NT ONLY" and is formatted as NTFS.
  47.  
  48. The 4th partition was 1M reserved for the OS/2 Boot Manager at the end
  49. of the phyiscal drive.
  50.  
  51. Initial Trials
  52. ==============
  53.  
  54. FDISK and FORMAT from DOS 6.0 was used to format the second disk
  55. followed by several attempts to load OS/2 on the second drive.  Some
  56. failed and others produced side effects I didn't like.
  57.  
  58. If the second disk is partitioned with a primary DOS partition, then
  59. that becomes logical drive D:.  The logical drive assignments on the
  60. first disk move up a letter.  D: becomes E:, E: becomes F:.  I couldn't
  61. live with this reassignment so I tried other solutions.
  62.  
  63. One try took advantage of an MSDOS 6.0 "feature" which allows you to
  64. create an extended DOS partition without having a primary DOS partition
  65. on the same drive.  I thought that this might solve the drive letter
  66. re-designation by eliminating the primary drive on disk 2 and it did --
  67. sort of!
  68.  
  69. After reinstalling OS/2 and the OS/2 Boot Manager things seemed OK, so I
  70. tried NT. It did not boot, and reported the following:
  71.  
  72.   HardError c000021a {fatal System Error}
  73.   Exception Processing Message c000021a Parameters e10c2088 0 0 0
  74.  
  75. Next I moved the data from one logical drive (E:) on the first disk to
  76. one on the second disk.  Then I installed OS/2 on E:.  NT didn't boot.
  77. I reinstalled NT, but the result was the same -- NT wouldn't boot.
  78.  
  79. Some detective work showed the System Indicator byte in the partition
  80. record for NT for the NT partition had been modified (to 0x17) by the
  81. OS/2 Boot Manager.  Restoring it to the original value (0x07) and making
  82. DOS the active partition allowed NT to boot successfully.
  83.  
  84. I have not seen this result reported before.  IBM's tech support did not
  85. recognize the problem either.
  86.  
  87. Disaster Installation
  88. =====================
  89.  
  90. NOTE: In the discussion that follows the "normal" behavior of the DOS
  91. and OS/2 operating systems as concerns LOGICAL DRIVE TO PHYSICAL DRIVE
  92. MAPPING is as follows:
  93.  
  94. Logical C:  Primary Dos partition on first physical drive (0x80).
  95. Logical D:  Primary Dos partition on SECOND physical drive (0x81).
  96. Logical E:, F:, etc.  are assigned in order first exhausting the logical
  97. drives in the extended DOS partition on the first physical drive (0x80)
  98. followed by the logical drives in the extended DOS partition on the
  99. second physical drive (0x81).
  100.  
  101. UNLESS the Primary DOS Partition on drive 0x81 HAS BEEN DELETED!  In
  102. that case all logical drives on 0x80 are assigned from in order starting
  103. at C: then all logical drives in the extended DOS partition on 0x81 are
  104. assigned.  The 'HOPSCOTCHING" back and forth from drive to drive in the
  105. "NORMAL" case is avoided.
  106.  
  107. NT was happy in its own partition, why not put OS/2 in its own
  108. partition?  This would free E: so it could be used as original and the
  109. use of the separate partition might solve the changing of NT's partition
  110. System Indicator byte.  I could put an HPFS in an unused logical drive
  111. in the extended DOS partition on the second drive.
  112.  
  113. The OS/2 FDISK reported the free space in unassigned partitions.  I
  114. designated the size and exited FDISK.  The install process now correctly
  115. indicated the partition was not formatted, I agreed, and FORMAT
  116. completed.  Next it automatically tried to reboot, but with this
  117. message:
  118.  
  119.   "Selected Partition is not formatted. Hit any key"
  120.  
  121. I booted DOS and discovered drive D: was not found.  The DOS command:
  122.  
  123.   UNFORMAT /PARTN /L
  124.  
  125. Showed:
  126.  
  127.   Disk 1    632
  128.     C:    128
  129.     E:    128    !!!
  130.     E:    128
  131.   Disk 2    495
  132.     D:    120    Not accessible by DOS (HPFS?)
  133.     F:    128
  134.     G:    128
  135.  
  136. All data on the original D: was lost.  I believe that MSDOS 6.0, OS/2
  137. FDISK, OS/2 Boot Manager do not collectively agree on the logical drive
  138. designations for a 2 disk installation with no primary DOS partition
  139. designated on the 2nd disk.  My use of a new feature of MSDOS 6.0
  140. probably contributed to this problem.
  141.  
  142. Good Result
  143. ===========
  144.  
  145. So I started over nearly from scratch (after restoring many 100s
  146. megabytes from tape)...
  147.  
  148. I replaced MSDOS 6.0 with IBM PCDOS 5.0.  Then deleted all logical
  149. drives and partitions except the PRIMARY DOS (with C: in it.)
  150.  
  151. The new configuration:
  152.  
  153.   Disk 1
  154.     :0    128M DOS Primary
  155.     C:         (IBM PCDOS 5.0)
  156.     :1    336M Extended DOS
  157.     D: (128)
  158.     E: (128)
  159.     F: (80)      (OS/2 2.1)
  160.     :2    167M Non-DOS (NT on NTFS)
  161.     :3    1M   Non-DOS (Boot Manager)
  162.  
  163.   Disk 2
  164.     :0    1M   DOS Primary
  165.     (Set System Indicator byte to 0)
  166.     :1    494M Extended DOS
  167.     G: (128)
  168.     H: (128)
  169.     I: (128)
  170.     J: (110)
  171.  
  172. I changed the System Indicator to 0 on the primary partition of disk 2
  173. so it would be not be recognized.  Then I followed this sequence:
  174.  
  175.   1.  Format drives D:-J:.
  176.  
  177.   2.  Made sure there were no remnants of the NT or MSDOS 6.0
  178.       installation on C: (both put hidden files in C:\.)
  179.  
  180.   3.  Install OS/2 (After slowing machine down by turning off all cache
  181.       and shadow ROM switches -- see the OS/2 installation notes for
  182.       non-IBM hardware).  Installation went smooth this time albeit
  183.       slowly.  Play with OS/2. It seems stable.
  184.  
  185.   4.  Capture the OS/2 partition record (see below).
  186.  
  187.   5.  Install NT.  The NT installation destroyed the OS/2 Boot Manager
  188.       information in the partition record.  Shame on NT.
  189.  
  190.   6.  Capture the NT partition record.
  191.  
  192.  
  193. OS/2 Boot Manager changes the partition record
  194. ==============================================
  195.  
  196. Create a new partition record that combines the OS/2 and NT data.  I did
  197. this by creating a copy of the NT partition record and hex edited the
  198. OS/2 boot manager partition data to it.
  199.  
  200. With this configuration the OS/2 Boot Manager is now active, but still
  201. modifies the NT partition record, so I keep two boot partition records
  202. and load the appropriate one from DOS when I need to change from NT to
  203. OS/2.
  204.  
  205.  
  206. Impressions
  207. ===========
  208.  
  209. MSDOS 6.00 and the OS/2 installation process are incompatible in the
  210. area of partition management for a second disk (perhaps only if you have
  211. not specified a primary partition on that disk.) This is what I believe
  212. led to loss of data in my cited in the discussion above.  I believe the
  213. OS/2 and MSDOS 6.0 behave differently with respect to LOGICAL DRIVE
  214. LETTER ASSIGNMENT when there is no PRIMARY DOS partition on a second
  215. disk (Physical 0x81.)
  216.  
  217. Certainly, OS/2 FDISK and FORMAT and the same named programs in DOS 6.0
  218. view the MSDOS 6.0 partition record on disk 2 (0x81) differently from
  219. each other.  Otherwise, I would not have had the confused drive letter
  220. assignment which led having lost data.  I solved the incompatibility by
  221. returning to an earlier DOS version which in turn forced a change of
  222. procedure.  I'll let the reader complete other squares on this test
  223. matrix.
  224.  
  225. The NT installation zeros SYSTEM INDICATOR of the OS/2 Boot Manager part
  226. of the partition record.  This can, of course, be reversed (e.g.  by
  227. saving the partition record before installing NT and restoring it when
  228. you wish.)
  229.  
  230. The OS/2 Boot Manager changes a byte in the NT boot partition record if
  231. NT is installed in its own NTFS partition on disk 1.  As a result, the
  232. OS/2 Boot Manager can not be active when I want to boot NT.
  233.  
  234. I solved the partition record problems by the use of a special program
  235. that can save and load partition records.  To boot NT I load a partition
  236. record that makes DOS the active partition and changes the System
  237. Indicator byte on the NT partition to the correct value.  To boot OS/2,
  238. you can just make the OS/2 Boot Manager partition active.  The details
  239. of this program are discussed below.
  240.  
  241. Appendix: Partition record management
  242. =====================================
  243.  
  244. The partition information is saved in sector 1 of track 0 and has the
  245. following structure:
  246.  
  247.   typedef unsigned char Byte;
  248.   typedef unsigned long Ulong;
  249.   typedef struct
  250.   {
  251.     Byte boot_ind;    // boot Indicator.  0 or 0x80 if active
  252.     Byte beg_cchr[3];    // Beginning of partition Track sector & head
  253.     Byte system_ind;    // 0x06 is BIG DOS primary
  254.             // 0x05 is Extended DOS
  255.             // 0x07 is NT - NTFS
  256.             // 0x0a is OS/2 Boot manager
  257.     Byte end_cchr[3];    // Ending of partition Track, sector and head
  258.     Ulong rel_sector;    // Starting sector number
  259.     Ulong num_sector;    // Length of partition in sectors
  260.   } PartionRecord;
  261.  
  262.   typedef struct
  263.   {
  264.     Byte bootStuff[ 0x1be ];
  265.     PartionRecord par[ 4 ];
  266.     Byte endStuff[2];
  267.   } BootRec;
  268.  
  269. To read a boot partition from disk, you can use the INT 0x13 function 2
  270. call.  To write use INT 0x13 function 3.
  271.  
  272.   INT 13 parameters:
  273.     AH = 02h - read, 03h to write
  274.     AL = number of sectors to read
  275.     CH = track (plus bits 8,9 of CL)
  276.     CL = sector (01 to number of sectors per track for the drive)
  277.     DH = head
  278.     DL = drive
  279.     ES:BX = buffer pointer
  280.  
  281. We don't have to worry about translating some large track number into
  282. appropriate bits of CL but can do something like the following:
  283.  
  284.   union REGS in;
  285.   struct SREGS seg;
  286.  
  287.   #define AX in.x.ax
  288.   #define BX in.x.bx
  289.   #define ES seg.es
  290.   #define CX in.x.cx
  291.   #define DX in.x.dx
  292.  
  293.   char buf[512];
  294.   char far * p = ( char far * )buf;
  295.  
  296.   AX = 0x0201;        // read 1 sector
  297.   BX = FP_OFF( p );    // into buf
  298.   ES = FP_SEG( p );
  299.   CX = 0x0001;        // from track 0, sector 1
  300.   DX = 0x0080;        // in drive 80 (81 is the second)
  301.   int86x( 0x13, &in, &in, &seg );
  302.  
  303. Now by casting the buffer to a boot record:
  304.  
  305.   BootRec *rec = (BootRec *)buf;
  306.   PartitionRecord *par = rec->par;
  307.  
  308. We can read or change data in the buffer.
  309.  
  310.   for (i = 0; i < 4; i++)
  311.     printf( " 0:%d %02x %02x\n", i, par[i].boot_ind, par[i].system_ind );
  312.  
  313. Here is the results of the above printf() statement with an active OS/2
  314. boot manager in the 4th partition and the NT System Indicator set to 07.
  315.  
  316.   0:0 00 06
  317.   0:1 00 05
  318.   0:2 00 07
  319.   0:3 80 0a
  320.  
  321. Reboot and the OS/2 Boot Manager comes up.  Select DOS and run the
  322. program again.
  323.  
  324.   0:0 00 06
  325.   0:1 00 05
  326.   0:2 00 17     !! Boot manager changed NT's System Indicator
  327.   0:3 80 0a
  328.  
  329. Just 1 little bit has changed.    But NT will not boot.  Change record
  330. again to allow NT to boot:
  331.  
  332.   0:0 80 06     Make 0 active
  333.   0:1 00 05
  334.   0:2 00 07     Good NT System Indicator
  335.   0:3 00 0a
  336.  
  337. Now NT boots (and by the way does not change the OS/2 Boot Manager
  338. record).
  339.  
  340. Given that we can read the partition data from the boot record, it is
  341. easy to change the data and write the modified boot record back to the
  342. disk.
  343.  
  344. Thanks to Steve Behman for suggestions, code and encouragement.
  345.  
  346. Dave Hillman
  347.  
  348.